import Vue from 'vue'
import App from './App.vue'
import router from './router/index.js'
import store from './store/index.js'
import axios from 'axios'

import './permission' // permission control
import './util/json'

// import element from 'element-ui'
// CDN引入
// import echarts from 'echarts'
import {
  message
} from 'ant-design-vue';
// import 'element-ui/lib/theme-chalk/index.css'
// import 'element-ui/lib/theme-chalk/display.css';
// import Clickoutside from 'element-ui/lib/utils/clickoutside.js';

// import VueLazyload from 'vue-lazyload'

import './assets/iconfont/iconfont.css';
import { checkMyCoursePageRouteAuth } from '@/util/syncRouter'
import './assets/css/public.css'

import './util/fontsizeAuto.js'
// import { DMessageClient } from '@/messageSocket/DMessageClient.js'  
// import { io } from '@/messageSocket/socketio/4.0/socket.io.min.js';
// import '@/messageSocket/DMessageClientsSharedWorker.js'

// Vue.use(new io({
//   debug: true,
//   connection: 'http://112.74.99.240:3001',
//   options: { transports: ['websocket', 'polling'] },
// }))

import Print from '../public/js/print.js';
Vue.use(Print);

// 开发调试工具
Vue.config.devtools = true;

Vue.prototype.http = axios
Vue.prototype.$antdMessage = message
// Vue.prototype.$antdMessage = () => {}
/* eslint-disable no-undef */
echarts && (Vue.prototype.$echarts = echarts)
// Vue.directive('Clickoutside', Clickoutside)
// Vue.use(ElementUI)
// 弹窗滚动条内容抖动 解决方法
// element.Dialog.props.lockScroll.default = false;
// Vue.component(message.name, message)

Vue.config.productionTip = false
Vue.prototype.mWindow = window

// 图片懒加载
Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: require('@/assets/images/imgError.png'),
  // loading: require('@/assets/images/loading.gif'),
  attempt: 1,
  // lazyComponent: true
})

// // 如果已登录 动态添加路由
// const userInfo = getCookie('userInfo')
// if (userInfo) {
//   checkMyCoursePageRouteAuth(JSON.parse(userInfo), router)
// }


new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')